package name.fowler.refactoring.simplestore;

final class MainClass {

    private static Logger logger;

    private MainClass() {}

	 static void main(String[] args) {
		// Create movies
		Movie movCinderella = new Movie("Cinderella", PriceCodes.Children);
		Movie movStarWars = new Movie("Star Wars", PriceCodes.Regular);
		Movie movGladiator = new Movie("Gladiator", PriceCodes.NewRelease);

		// Create customers
		Customer custMickeyMouse = new Customer("Mickey Mouse");

		// Create rentals
         int daysRented = 5;
		Rental rental1 = new Rental(movCinderella, daysRented);
		Rental rental2 = new Rental(movStarWars, daysRented);
		Rental rental3 = new Rental(movGladiator, daysRented);

		// Assign rentals to customers
		custMickeyMouse.addRental(rental1);
		custMickeyMouse.addRental(rental2);
		custMickeyMouse.addRental(rental3);

		// Generate invoice
		String statement = custMickeyMouse.getStatement();

		// Print the statement
         logger.log(statement);
	}

    static void setLogger(Logger logger) {
        MainClass.logger = logger;
    }
}

